<?php
class OldAttributesBehavior extends CActiveRecordBehavior
{
	private $_oldattributes = array();

	public function afterFind($event)
	{
		if (!isset($GLOBALS['saveOldAttributes'])) return;
		// Save old values
		Yii::trace(get_class($this->getOwner()).'.'.get_class($this).'.afterFind()','app.components.behaviors');
		$this->setOldAttributes($this->Owner->getAttributes());
	}

	public function getOldAttributes()
	{
		return $this->_oldattributes;
	}

	public function setOldAttributes($value)
	{
		$this->_oldattributes=$value;
	}
}